# Maintainer: Zach Bacon <zachbacon@vba-m.com

_realname=gnome-text-editor
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=48.2
pkgrel=2
pkgdesc="A simple text editor for the GNOME desktop (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://apps.gnome.org/TextEditor/'
msys2_repository_url='https://gitlab.gnome.org/GNOME/gnome-text-editor'
msys2_references=(
  'archlinux: gnome-text-editor'
)
license=('spdx:GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-cairo"
         "${MINGW_PACKAGE_PREFIX}-editorconfig-core-c"
         "${MINGW_PACKAGE_PREFIX}-gettext-runtime"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-gtk4"
         "${MINGW_PACKAGE_PREFIX}-gtksourceview5"
         "${MINGW_PACKAGE_PREFIX}-libspelling"
         "${MINGW_PACKAGE_PREFIX}-libadwaita"
         "${MINGW_PACKAGE_PREFIX}-pango")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-gettext-tools"
             "${MINGW_PACKAGE_PREFIX}-itstool")
source=(https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz)
sha256sums=('fc1f5d475bdd27d4c0439a5b8fe10d6e401b42f1dba3d04b7567839036ee202b')

build() {
  mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson.exe setup \
    --prefix=${MINGW_PREFIX} \
    --wrap-mode=nodownload \
    --default-library=both \
    --buildtype=plain \
    -Dbugreport_url=https://github.com/msys2/MINGW-packages/issues \
    "../${_realname}-${pkgver}"

  ${MINGW_PREFIX}/bin/meson.exe compile
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/meson.exe install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
